import pandas as pd

pd.set_option('display.max_columns', None)
pd.set_option('display.width', None)
pd.set_option('display.max_colwidth', None)

if __name__ == '__main__':
    users = pd.read_csv('20251119users.csv')
    print(users.head())

    strArr = []

    with open('chat_stat.csv', 'r', encoding='utf-8') as f:
        read = f.read()
        split = read.split('\n')
        for e in split:
            strArr.append(e)

    data = [s.split('\t') for s in strArr]
    detail = pd.DataFrame(data, columns=['账号', '姓名', '对话数'])

    merge = pd.merge(detail, users, left_on="账号", right_on='user_account', how="left")
    print(merge)
    merge.to_excel('办公小智统计.xlsx',index=False)
